package com.lzj.jiangxindaojia.wxutils;

import java.util.Random;

public class ResourceUtil {
  
 /** 
  * 随机生成字符串 
  * @param length 字符串的长度 
  * @return  随机字符串 
  */ 
 public static String createRandomString(int length) { 
  String source = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
  Random random = new Random();
  StringBuilder builder = new StringBuilder(); 
  for (int i = 0; i < length; i++) { 
   int position = random.nextInt(source.length()); 
   builder.append(source.charAt(position)); 
  } 
 
  return builder.toString(); 
 } 
  
 public static String generateOutTradeNo(int n) { 
  StringBuilder builder = new StringBuilder(); 
  Random random = new Random(); 
  for (int i = 0; i < n; i++) { 
   builder.append(random.nextInt(10)); 
  } 
 
  return builder.toString(); 
 } 
  
}